<?php
//$updatesql = "update ims_modules set version = '1.1.1' where `name`='weisrc_dish' LIMIT 1;";
//pdo_run($updatesql);

$sql = "
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables_seat` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `tablesid` int(10) unsigned NOT NULL,
  `title` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_dinnertime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_wxappsetting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0',
  `wxappid` varchar(200) DEFAULT '' COMMENT '',
  `wxappweid` int(10) unsigned NOT NULL DEFAULT '0',
  `bartitle` varchar(200) DEFAULT '' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '添加日期',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardlog` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `from_user` varchar(50) NOT NULL COMMENT '',
            `title` varchar(200) NOT NULL COMMENT '标题',
            `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '业务类型-用户充值:1,消费:2',
            `operationtype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '积分操作类型 增加:1  扣除:0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
            `dateline` int(10) NOT NULL DEFAULT '0',
            `remark` text NOT NULL DEFAULT '' COMMENT '备注',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_cardsetting` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `title` varchar(200) NOT NULL DEFAULT '',
            `rule` text NOT NULL COMMENT '',
            `opencardcredit` int(10) NOT NULL DEFAULT '0' COMMENT '开卡奖励消费积分',
            `sendcredit` int(10) NOT NULL DEFAULT '0' COMMENT '推荐用户奖励消费积分',
            `startmoney` int(10) NOT NULL DEFAULT '0' COMMENT '多少金额可能抵扣',
            `maxcredit` int(10) NOT NULL DEFAULT '0' COMMENT '每次消费最多可以使用几个积分',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardprivilege` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '特权名称',
            `desc` varchar(100) NOT NULL DEFAULT '' COMMENT '特权名称',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardprice` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `daycount` int(10) NOT NULL DEFAULT '0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_card` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL DEFAULT '',
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `uid` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
            `cardpre` varchar(10) NOT NULL DEFAULT '',
            `cardno` int(10) NOT NULL DEFAULT '0' COMMENT '会员卡号',
            `cardnumber` varchar(50) NOT NULL DEFAULT '',
            `headimgurl` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
            `nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `password` varchar(200) NOT NULL DEFAULT '' COMMENT '登录密码',
            `coin` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '余额',
            `balance_score` int(10) NOT NULL DEFAULT '0' COMMENT '剩余积分',
            `total_score` int(10) NOT NULL DEFAULT '0' COMMENT '总积分',
            `spend_score` int(10) NOT NULL DEFAULT '0' COMMENT '消费积分',
            `sign_score` int(10) NOT NULL DEFAULT '0' COMMENT '签到积分',
            `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总消费金额',
            `carnumber` varchar(100) NOT NULL DEFAULT '' COMMENT '车牌号码',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `updatetime` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            `lasttime` int(10) NOT NULL DEFAULT '0' COMMENT '到期时间',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardprivilege` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '特权名称',
            `desc` varchar(100) NOT NULL DEFAULT '' COMMENT '特权名称',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardprice` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `daycount` int(10) NOT NULL DEFAULT '0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardlog` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL COMMENT '',
            `title` varchar(200) NOT NULL COMMENT '标题',
            `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '业务类型-用户充值:1,消费:2',
            `operationtype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '积分操作类型 增加:1  扣除:0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
            `dateline` int(10) NOT NULL DEFAULT '0',
            `remark` text NOT NULL DEFAULT '' COMMENT '备注',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_storecard` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL DEFAULT '',
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `uid` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
            `cardpre` varchar(10) NOT NULL DEFAULT '',
            `cardno` int(10) NOT NULL DEFAULT '0' COMMENT '会员卡号',
            `cardnumber` varchar(50) NOT NULL DEFAULT '',
            `headimgurl` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
            `nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `password` varchar(200) NOT NULL DEFAULT '' COMMENT '登录密码',
            `coin` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '余额',
            `balance_score` int(10) NOT NULL DEFAULT '0' COMMENT '剩余积分',
            `total_score` int(10) NOT NULL DEFAULT '0' COMMENT '总积分',
            `spend_score` int(10) NOT NULL DEFAULT '0' COMMENT '消费积分',
            `sign_score` int(10) NOT NULL DEFAULT '0' COMMENT '签到积分',
            `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总消费金额',
            `carnumber` varchar(100) NOT NULL DEFAULT '' COMMENT '车牌号码',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `updatetime` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            `lasttime` int(10) NOT NULL DEFAULT '0' COMMENT '到期时间',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_school` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(50) NOT NULL COMMENT '区域名称',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `print_type` varchar(50) NOT NULL COMMENT '打印机类型',
  `print_usr` varchar(50) DEFAULT '',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `goodsid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `optionid` varchar(200) DEFAULT '',
  `optionname` varchar(200) DEFAULT '',
  `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
  `total` int(10) unsigned NOT NULL DEFAULT '0',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否已打印',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_refund_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `from_user` varchar(50) NOT NULL,
  `remark` varchar(1000) NOT NULL DEFAULT '0' COMMENT '退款备注',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商户订单号',
  `transaction_id` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信订单号',
  `out_refund_no` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信订单号',
  `refund_id` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信退款单号',
  `total_fee` varchar(50) NOT NULL DEFAULT '0' COMMENT '订单总金额',
  `refund_fee` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信退款单号',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  `err_code_des` varchar(200) NOT NULL DEFAULT '0' COMMENT '错误代码描述',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_checkuser` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `from_user` varchar(100) DEFAULT '' COMMENT '用户ID',
  `is_check` tinyint(1) DEFAULT '0',
  `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_openid` (`from_user`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_poster` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `keywords` varchar(50) DEFAULT '',
  `title` varchar(50) DEFAULT '',
  `data` text,
  `bg` varchar(500) DEFAULT '',
  `miss_font` varchar(50) DEFAULT NULL,
  `first_info` varchar(200) DEFAULT NULL,
  `miss_wait` varchar(200) DEFAULT NULL,
  `starttime` int(10) DEFAULT '0',
  `endtime` int(10) DEFAULT '0',
  `miss_start` varchar(200) DEFAULT NULL,
  `miss_end` varchar(200) DEFAULT NULL,
  `miss_sub` varchar(200) DEFAULT NULL,
  `miss_resub` varchar(200) DEFAULT NULL,
  `miss_temp` varchar(200) DEFAULT NULL,
  `miss_back` varchar(200) DEFAULT NULL,
  `miss_finish` varchar(200) DEFAULT NULL,
  `miss_youzan` varchar(200) DEFAULT NULL,
  `miss_cj` varchar(200) DEFAULT NULL,
  `stitle` text,
  `sthumb` text,
  `sdesc` text,
  `surl` text,
  `miss_name` varchar(50) DEFAULT '',
  `xzlx` int(1) NOT NULL DEFAULT '0',
  `fans_limit` int(1) NOT NULL DEFAULT '0',
  `area` text NOT NULL,
  `sex` int(1) NOT NULL DEFAULT '0',
  `iptype` int(1) NOT NULL DEFAULT '0',
  `posttype` int(1) NOT NULL DEFAULT '0',
  `miss_num` int(10) DEFAULT '0',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `weid` (`weid`)
)ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `type` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `savewineid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
    `goodsid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `total` int(10) unsigned NOT NULL DEFAULT '0',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_notice_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `noticeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `from_user` varchar(50) NOT NULL,
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_pic` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `styleid` int(10) unsigned NOT NULL,
  `weid` int(10) unsigned NOT NULL,
  `pictitle` varchar(100) NOT NULL DEFAULT '',
  `picurl` varchar(200) NOT NULL DEFAULT '',
  `picimage` varchar(500) NOT NULL DEFAULT '',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_style` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `title` varchar(100) NOT NULL,
    `type` varchar(100) NOT NULL,
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `slidetype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
    `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_notice` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '导航名称',
  `content` text COMMENT '',
  `url` varchar(1000) DEFAULT NULL,
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_deliverytime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `price` decimal(10,2) DEFAULT '0.00',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE if not exists `ims_weisrc_dish_goods_option` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `goodsid` int(10) DEFAULT '0',
  `start` varchar(50) DEFAULT '',
  `title` varchar(50) DEFAULT '',
  `price` decimal(10,2) DEFAULT '0.00',
  `stock` int(11) DEFAULT '0',
  `displayorder` int(11) DEFAULT '0',
  `specs` text,
  PRIMARY KEY (`id`),
  KEY `indx_goodsid` (`goodsid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE if not exists `ims_weisrc_dish_fengniao` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `orderid` int(11) DEFAULT '0' COMMENT '',
  `open_order_code` varchar(200) DEFAULT '' COMMENT '蜂鸟配送开放平台返回的订单号',
  `partner_order_code` varchar(200) DEFAULT '' COMMENT '商户自己的订单号',
  `order_status` int(11) DEFAULT '0' COMMENT '状态码',
  `push_time` int(11) DEFAULT '0' COMMENT '状态推送时间(毫秒)',
  `carrier_driver_name` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员姓名',
  `carrier_driver_phone` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员电话',
  `description` varchar(200) DEFAULT '' COMMENT '描述信息',
  `address` varchar(200) DEFAULT '' COMMENT '定点次日达服务独有的字段: 微仓地址',
  `latitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓纬度',
  `longitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓经度',
  `cancel_reason` int(11) DEFAULT '0' COMMENT '订单取消原因. 1:用户取消, 2:商家取消',
  `error_code` varchar(200) DEFAULT '' COMMENT '错误编码',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_distance` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begindistance` int(10) unsigned NOT NULL,
  `enddistance` int(10) unsigned NOT NULL,
  `sendingprice` decimal(10,2) DEFAULT '0.00' COMMENT '起送价格',
  `dispatchprice` decimal(10,2) DEFAULT '0.00',
  `freeprice` decimal(10,2) DEFAULT '0.00',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_delivery_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `orderid` int(10) NOT NULL DEFAULT '0' COMMENT '订单id',
    `delivery_id` int(10) NOT NULL DEFAULT '0' COMMENT '配送员id',
    `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_recharge` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `title` varchar(200) NOT NULL COMMENT '活动名称',
    `recharge_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '充值多少',
    `give_value` int(10) NOT NULL DEFAULT '0' COMMENT '赠送多少',
    `total` int(10) NOT NULL DEFAULT '0' COMMENT '几期',
    `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `content` text NOT NULL DEFAULT '' COMMENT '',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_recharge_record` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `rechargeid` int(10) NOT NULL DEFAULT '0' COMMENT '',
    `from_user` varchar(100) DEFAULT '',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `orderid` int(10) NOT NULL DEFAULT '0' COMMENT '订单id',
    `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `remark` text NOT NULL DEFAULT '' COMMENT '备注',
    `givetime` int(10) NOT NULL DEFAULT '0',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cashlog` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL DEFAULT '0',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0',
    `from_user` varchar(200) DEFAULT '' COMMENT '',
    `logtype` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '日志类型1佣金2配送佣金',
    `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型1微信2余额',
    `price` decimal(10,2) default '0.00' COMMENT '申请金额',
    `charges` decimal(10,2) default '0.00' COMMENT '手续费',
    `successprice` decimal(10,2) default '0.00' COMMENT '到帐金额',
    `totalprice` decimal(10,2) default '0.00' COMMENT '余额',
    `trade_no` varchar(200) DEFAULT '0' COMMENT '',
    `payment_no` varchar(200) DEFAULT '0' COMMENT '',
    `remark` varchar(1000) DEFAULT '0' COMMENT '',
    `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
    `handletime` int(10) DEFAULT '0' COMMENT '处理时间',
    `dateline` int(10) DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_credits_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `from_user` varchar(100) DEFAULT '' COMMENT '',
    `credittype` varchar(100) DEFAULT '' COMMENT '积分类型',
    `num` decimal(10,2) default '0.00',
    `operator` varchar(100) DEFAULT '' COMMENT '',
    `remark` varchar(1000) DEFAULT NULL COMMENT '内容',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_deliveryarea` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属门店',
  `title` varchar(50) NOT NULL COMMENT '区域名称',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_coupon_record` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `acid` int(10) unsigned NOT NULL,
  `card_id` varchar(50) NOT NULL,
  `openid` varchar(50) NOT NULL,
  `friend_openid` varchar(50) NOT NULL,
  `givebyfriend` tinyint(3) unsigned NOT NULL,
  `code` varchar(50) NOT NULL,
  `hash` varchar(32) NOT NULL,
  `addtime` int(10) unsigned NOT NULL,
  `usetime` int(10) unsigned NOT NULL,
  `status` tinyint(3) NOT NULL,
  `clerk_name` varchar(15) NOT NULL,
  `clerk_id` int(10) unsigned NOT NULL,
  `store_id` int(10) unsigned NOT NULL,
  `clerk_type` tinyint(3) unsigned NOT NULL,
  `couponid` int(10) unsigned NOT NULL,
  `uid` int(10) unsigned NOT NULL,
  `grantmodule` varchar(255) NOT NULL,
  `remark` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `uniacid` (`uniacid`,`acid`),
  KEY `card_id` (`card_id`),
  KEY `hash` (`hash`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_dispatcharea` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属门店',
    `title` varchar(50) NOT NULL COMMENT '区域名称',
    `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_wechat_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(50) NOT NULL COMMENT '',
  `url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_modules_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(50) NOT NULL COMMENT '',
  `url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_order_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `content` varchar(1000) DEFAULT NULL COMMENT '内容',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_service_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `from_user` varchar(100) DEFAULT '',
    `content` varchar(1000) DEFAULT NULL COMMENT '内容',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_commission` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `agentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级编号',
    `ordersn` varchar(100) DEFAULT '' COMMENT '',
    `from_user` varchar(100) DEFAULT '' COMMENT '购买者openid',
    `price` decimal(10,2) default '0.00',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `from_user` varchar(100) DEFAULT '',
    `savenumber` varchar(100) NOT NULL DEFAULT '' COMMENT '存酒卡号',
    `title` varchar(200) DEFAULT NULL COMMENT '物品名称',
    `username` varchar(100) DEFAULT NULL COMMENT '用户姓名',
    `tel` varchar(30) DEFAULT NULL COMMENT '联系电话',
    `remark` text NOT NULL DEFAULT '' COMMENT '备注',
    `displayorder` int(10) unsigned NOT NULL DEFAULT '0',
    `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
    `takeouttime` int(10) unsigned NOT NULL DEFAULT '0',
    `savetime` int(10) unsigned NOT NULL DEFAULT '0',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `type` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `savewineid` int(10) unsigned NOT NULL,
  `goodsid` int(10) unsigned NOT NULL,
  `total` int(10) unsigned NOT NULL DEFAULT '1',
  `remark` varchar(100) DEFAULT NULL COMMENT '',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `dateline` int(10) unsigned NOT NULL,
  `savetime` int(10) unsigned NOT NULL DEFAULT '0',
  `takeouttime` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tpl_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `ordersn` varchar(100) DEFAULT '' COMMENT '',
    `from_user` varchar(100) DEFAULT '' COMMENT '接收者openid',
    `content` varchar(1000) DEFAULT '' COMMENT '内容',
    `result` varchar(200) DEFAULT '' COMMENT '内容结果',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_businesslog` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `uid` int(10) unsigned NOT NULL,
  `price` varchar(20) DEFAULT '' COMMENT '申请金额',
  `haveprice` varchar(20) DEFAULT '' COMMENT '已申请总金额',
  `totalprice` varchar(20) DEFAULT '' COMMENT '当时可总金额',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `handletime` int(10) DEFAULT '0' COMMENT '处理时间',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_coupon` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `levelid` tinyint(1) NOT NULL DEFAULT '0' COMMENT '所属人群',
    `title` varchar(50) NOT NULL COMMENT '优惠券名称',
    `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片',
    `attr_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '属性 1=普通券 2=营销券',
    `ruletype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=不限 2=首单',
    `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '优惠券类型 1=优惠券 2=代金券 3=礼品券 4=积分兑换',
    `gmoney` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
    `dmoney` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '抵用金额',
    `content` text NOT NULL COMMENT '详细内容',
    `totalcount` int(10) NOT NULL DEFAULT '0' COMMENT '发放总数',
    `usercount` int(10) NOT NULL DEFAULT '0' COMMENT '每人领取张数',
    `ticket_ty` tinyint(1) NOT NULL DEFAULT '0' COMMENT '积分兑换优惠券类型 1=优惠券2=代金券3=礼品券',
    `ticket_id` int(10) NOT NULL DEFAULT '0' COMMENT '优惠券id',
    `needscore` int(10) NOT NULL DEFAULT '0' COMMENT '兑换需要积分',
    `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_sncode` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `couponid` int(10) NOT NULL DEFAULT '0' COMMENT '优惠券id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `from_user` varchar(100) NOT NULL COMMENT 'openid',
    `title` varchar(40) NOT NULL,
    `sncode` varchar(100) NOT NULL COMMENT 'sn码',
    `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1优惠券2代金券3礼品券',
    `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `isshow` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否显示 用户删除时更新',
    `winningtime` int(10) NOT NULL DEFAULT '0' COMMENT '生成时间',
    `usetime` int(10) NOT NULL DEFAULT '0' COMMENT '使用时间',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_fans` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `from_user` varchar(50) DEFAULT '' COMMENT '用户ID',
  `nickname` varchar(50) DEFAULT '',
  `headimgurl` varchar(500) DEFAULT '',
  `username` varchar(50) DEFAULT '',
  `mobile` varchar(50) DEFAULT '',
  `address` varchar(200) DEFAULT '',
  `sex` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '性别',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `status` tinyint(1) DEFAULT '1',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `indx_rid` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_reservation` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `tablezonesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `time` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables_order` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `tablezonesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '名字(桌台号)',
  `is_seat` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `user_count` int(10) NOT NULL DEFAULT '0' COMMENT '可供就餐人数',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tablezones` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `limit_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `reservation_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `table_count` int(10) NOT NULL DEFAULT '0' COMMENT '餐桌数量',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_queue_setting` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `limit_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `prefix` varchar(50) NOT NULL COMMENT '',
  `starttime` varchar(50) NOT NULL DEFAULT '00:00' COMMENT '开始时间',
  `endtime` varchar(50) NOT NULL DEFAULT '23:59' COMMENT '结束时间',
  `notify_number` int(10) NOT NULL DEFAULT '0' COMMENT '通知人数',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_queue_order` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `queueid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `num` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  `mobile` varchar(30) NOT NULL DEFAULT '' COMMENT '',
  `usercount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `isnotify` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_account` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` varchar(1000) NOT NULL COMMENT '',
  `uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `from_user` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  `accountname` varchar(50) NOT NULL DEFAULT '',
  `password` varchar(200) NOT NULL DEFAULT '',
  `salt` varchar(10) NOT NULL DEFAULT '',
  `pwd` varchar(50) NOT NULL COMMENT '',
  `mobile` varchar(20) NOT NULL COMMENT '',
  `email` varchar(20) NOT NULL COMMENT '',
  `username` varchar(50) NOT NULL COMMENT '',
  `pay_account` varchar(200) NOT NULL COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '2' COMMENT '状态',
  `role` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1:店长,2:店员,3:区管理员',
  `lastvisit` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `lastip` varchar(15) NOT NULL COMMENT '',
  `areaid` int(10) NOT NULL DEFAULT '0' COMMENT '区域id',
  `is_admin_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_goods` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_goodscate` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_storeopen` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_queue` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_service` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_boss` tinyint(1) NOT NULL DEFAULT 0 COMMENT '',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `remark` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_template` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) NOT NULL DEFAULT '0' COMMENT '',
  `template_name` varchar(50) NOT NULL DEFAULT 'style1',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_ad` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `title` varchar(100) NOT NULL DEFAULT '',
  `url` varchar(200) NOT NULL DEFAULT '',
  `thumb` varchar(500) NOT NULL DEFAULT '',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `position` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:首页,2:商家页',
  `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
  `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
  `displayorder` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否显示',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_sms_checkcode` (
        `id` int(10) NOT NULL AUTO_INCREMENT,
        `weid` int(10) unsigned NOT NULL,
        `from_user` varchar(100) DEFAULT '' COMMENT '用户ID',
        `tel` varchar(30) NOT NULL DEFAULT '' COMMENT '手机',
        `checkcode` varchar(100) DEFAULT '' COMMENT '验证码',
        `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态 0未使用1已使用',
        `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
        PRIMARY KEY (`id`)
)  ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_mealtime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_address` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL,
  `realname` varchar(20) NOT NULL,
  `mobile` varchar(11) NOT NULL,
  `address` varchar(300) NOT NULL,
  `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_collection` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_feedback` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `from_user` varchar(100) DEFAULT '',
    `star` tinyint(1) NOT NULL DEFAULT '5' COMMENT '等级',
    `content` varchar(500) DEFAULT '' COMMENT '回复内容',
    `displayorder` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_type` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `name` varchar(50) NOT NULL COMMENT '类型名称',
  `parentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID,0为第一级',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_label` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(50) NOT NULL COMMENT '标签名称',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_useraddress` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL DEFAULT '',
  `realname` varchar(20) NOT NULL DEFAULT '',
  `mobile` varchar(20) NOT NULL DEFAULT '',
  `address` varchar(300) NOT NULL DEFAULT '',
  `doorplate` varchar(300) NOT NULL DEFAULT '',
  `gender` tinyint(1) NOT NULL DEFAULT '1',
  `isdefault` tinyint(1) NOT NULL DEFAULT '0',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

alter table ims_weisrc_dish_goods modify column `thumb` varchar(500) NOT NULL DEFAULT '';
alter table ims_weisrc_dish_stores modify column `logo` varchar(500) NOT NULL DEFAULT '' COMMENT '商家logo';
alter table ims_weisrc_dish_savewine_log modify column `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态';
";
pdo_run($sql);
if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_search')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_search` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_storeinfo')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_storeinfo` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'deliverytime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `deliverytime` int(10) NOT NULL DEFAULT '0' COMMENT '配送时间';");
}
$menu = pdo_fetch("SELECT * FROM " . tablename("modules_bindings") . " WHERE module = 'weisrc_dish' AND entry='menu' AND
         do='login' LIMIT 1;");
if (!$menu) {
    pdo_run("insert " . tablename("modules_bindings") . "(`module`,`entry`,`title`,`do`,`direct`) values ('weisrc_dish', 'menu', '商家登录','login',1);");
} else {
    pdo_run("UPDATE " . tablename("modules_bindings") . " SET `direct`=1 WHERE eid=".$menu['eid']." LIMIT 1;");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_check_user')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_check_user` tinyint(1) NOT NULL DEFAULT '0' COMMENT '用户是否需要审核';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'qqmapapi')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `qqmapapi` varchar(200) DEFAULT '' COMMENT '';");
}

//
//`auto_finish_time` int(10) unsigned NOT NULL DEFAULT '24' COMMENT '自动时间',
//  `isshow_table_store` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
//  `isshow_table_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
if(!pdo_fieldexists('weisrc_dish_setting', 'auto_finish_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `auto_finish_time` int(10) unsigned NOT NULL DEFAULT '24' COMMENT '自动时间';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'isshow_table_store')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `isshow_table_store` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'isshow_table_order')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `isshow_table_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_setting', 'is_school')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_school` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_cart', 'dateline')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')." ADD `dateline` int(10) DEFAULT '0' COMMENT '创建时间';");
}

if(!pdo_fieldexists('weisrc_dish_print_goods', 'price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_print_goods', 'storeid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `storeid` int(10) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_print_goods', 'optionid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `optionid` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_print_goods', 'optionname')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `optionname` varchar(200) DEFAULT '';");
}


if(!pdo_fieldexists('weisrc_dish_savewine_goods', 'remark')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_savewine_goods')." ADD `remark` varchar(100) DEFAULT NULL COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_ad', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_ad')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}

if (!pdo_fieldexists('weisrc_dish_fans', 'is_check')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `is_check` tinyint(1) DEFAULT '0';");
}

if (!pdo_fieldexists('weisrc_dish_savewine_record','type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_savewine_record')." ADD `type` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
//

if (!pdo_fieldexists('weisrc_dish_pic','nowprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_pic')." ADD `nowprice` varchar(50) NOT NULL DEFAULT '';");
}
if (!pdo_fieldexists('weisrc_dish_savewine_log','tablesid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_savewine_log')." ADD `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_category','savewinetime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `savewinetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}

if (!pdo_fieldexists('weisrc_dish_pic','oldprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_pic')." ADD `oldprice` varchar(50) NOT NULL DEFAULT '';");
}

if (!pdo_fieldexists('weisrc_dish_stores','is_ld_wxserver')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_ld_wxserver` tinyint(1) NULL default NULL;");
}
if (!pdo_fieldexists('weisrc_dish_stores','is_wxapp_check')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_wxapp_check` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

if (!pdo_fieldexists('weisrc_dish_stores','card_title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `card_title` varchar(50) DEFAULT '' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_stores','card_rule')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `card_rule` text NOT NULL COMMENT '';");
}
//

if (!pdo_fieldexists('weisrc_dish_stores','is_sys_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送';");
}
if (!pdo_fieldexists('weisrc_dish_order','is_sys_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送';");
}

if (!pdo_fieldexists('weisrc_dish_order','dinner_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `dinner_time` varchar(50) NOT NULL DEFAULT '' COMMENT '用餐时间';");
}



if (!pdo_fieldexists('weisrc_dish_order','daycount')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `daycount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
//

if (!pdo_fieldexists('weisrc_dish_stores','is_check_user')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_check_user` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否用户审核';");
}

if (!pdo_fieldexists('weisrc_dish_stores','is_fengniao_area')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_fengniao_area` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用蜂鸟配送区域';");
}

if (!pdo_fieldexists('weisrc_dish_coupon','goodsids')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `goodsids` varchar(1000) NOT NULL DEFAULT '0' COMMENT '商品';");
}
if(!pdo_fieldexists('weisrc_dish_type', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_type')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}
if(!pdo_fieldexists('weisrc_dish_area', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_area')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}
if(!pdo_fieldexists('weisrc_dish_notice', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_notice')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}
if (!pdo_fieldexists('weisrc_dish_stores','remarkinfo')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `remarkinfo` varchar(1000) DEFAULT '可输入口味偏好要求(选填)' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_stores','is_default_givecredit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_default_givecredit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '默认1,自定义2';");
}
if (!pdo_fieldexists('weisrc_dish_stores','givecredit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `givecredit` int(10) NOT NULL DEFAULT '0' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_stores','is_locktables')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_locktables` tinyint(1) NOT NULL DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_stores','ld_wxserver_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `ld_wxserver_url` varchar(255) NULL default NULL;");
}
if(!pdo_fieldexists('weisrc_dish_reservation', 'label')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_reservation')." ADD `label` varchar(50) NOT NULL DEFAULT '' COMMENT '标签';");
}
if(!pdo_fieldexists('weisrc_dish_reservation', 'displayorder')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_reservation')." ADD `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'result')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `result` varchar(1000) DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'trade_no')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `trade_no` varchar(200) DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'payment_no')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `payment_no` varchar(200) DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'default_jump')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `default_jump` tinyint(2) NOT NULL DEFAULT '1' COMMENT '默认类型';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_brand')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_brand` tinyint(1) NOT NULL DEFAULT '0' COMMENT '品牌商家';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_meal_pay_confirm')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_meal_pay_confirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '店内点餐在线支付是否需要确认';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_auto_confirm')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_auto_confirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否自动确认订单';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_order_autoconfirm')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_order_autoconfirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_newlimitprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_newlimitprice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '新顾客满减';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_oldlimitprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_oldlimitprice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '老顾客满减';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'default_jump')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `default_jump` tinyint(2) NOT NULL DEFAULT '1' COMMENT '默认类型';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_fengniao')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_fengniao` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

//`label` varchar(50) NOT NULL DEFAULT '' COMMENT '标签'
if(!pdo_fieldexists('weisrc_dish_stores', 'is_reservation_dish')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_reservation_dish` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_days')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_days` int(10) NOT NULL DEFAULT '7' COMMENT '预订天数';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'default_jump_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `default_jump_url` varchar(500) NOT NULL DEFAULT '' COMMENT '默认链接';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'tplboss')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplboss` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'kefuqrcode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `kefuqrcode` varchar(500) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'visit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `visit` int(10) DEFAULT '0';");
}

//

if(!pdo_fieldexists('weisrc_dish_setting', 'fengniao_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fengniao_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:正式启用;2:调试阶段';");
}


if(!pdo_fieldexists('weisrc_dish_setting', 'is_auto_commission')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_auto_commission` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'auto_commission_coin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `auto_commission_coin`  int(10) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tplmission')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplmission` varchar(200) DEFAULT '' COMMENT '模板id';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'fengniao_appid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fengniao_appid` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'fengniao_key')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fengniao_key` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tplapplynotice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplapplynotice` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_notice_boss')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_notice_boss` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_notice_queue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_notice_queue` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'accountname')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `accountname` varchar(50) NOT NULL DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'password')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `password` varchar(200) NOT NULL DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'salt')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `salt` varchar(10) NOT NULL DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'lastvisit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `lastvisit` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'lastip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `lastip` varchar(15) NOT NULL COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_account', 'is_admin_goods')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_admin_goods` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_admin_goodscate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_admin_goodscate` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_admin_storeopen')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_admin_storeopen` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_admin_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_admin_money` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_list')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_list` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否在列表显示';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_add_dish')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_add_dish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加菜';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_add_order')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_add_order` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加单';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery_nowtime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery_nowtime` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'thumbs')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `thumbs` text NOT NULL COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_announce')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_announce` varchar(1000) NOT NULL DEFAULT '' COMMENT '预定公告';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_business')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_business` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持子商户支付';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_id` int(10) NOT NULL DEFAULT '0' COMMENT '子商户活动ID';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_order_tip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_order_tip` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
//ALTER TABLE ims_weisrc_dish_stores ADD `is_business` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持子商户支付';
//ALTER TABLE ims_weisrc_dish_stores ADD `business_id` int(10) NOT NULL DEFAULT '0' COMMENT '子商户活动ID';

if(!pdo_fieldexists('weisrc_dish_stores', 'wechat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'alipay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'credit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'delivery_isnot_today')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `delivery_isnot_today` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'default_user_count')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `default_user_count` int(10) unsigned NOT NULL DEFAULT '5' COMMENT '默认的用餐人数';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'wechat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'alipay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'credit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_speaker')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'apiclient_cert')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `apiclient_cert` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'apiclient_key')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `apiclient_key` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'rootca')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `rootca` tinyint(1) NOT NULL DEFAULT '0' COMMENT ''");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_speaker')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'yilian_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `yilian_type` tinyint(1) DEFAULT '1';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'position_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `position_type` tinyint(1) DEFAULT '1';");
}

//ALTER TABLE ims_weisrc_dish_setting ADD `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';
//ALTER TABLE ims_weisrc_dish_stores ADD `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';
if (!pdo_fieldexists('weisrc_dish_fans', 'storeid')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `storeid` int(11) DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tplcoupon')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplcoupon` varchar(200) DEFAULT '' COMMENT '模板id';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'lastsendtime')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `lastsendtime` int(10) DEFAULT '0';");
}


if (!pdo_fieldexists('weisrc_dish_fans', 'sceneid')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `sceneid` int(11) DEFAULT NULL;");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'ticketid')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `ticketid` varchar(200) DEFAULT NULL;");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'url')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `url` varchar(500) DEFAULT NULL;");
}



if (!pdo_fieldexists('weisrc_dish_fans', 'scene_str')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `scene_str` varchar(500) DEFAULT '';");
}
//
if (!pdo_fieldexists('weisrc_dish_fans', 'totalcount')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `totalcount` int(10) DEFAULT '0' COMMENT '交易次数';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'totalprice')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `totalprice` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '交易总金额';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'avgprice')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `avgprice` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '平均金额';");
}

if (!pdo_fieldexists('weisrc_dish_fans', 'uid')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `uid` int(11) DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'paytime')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `paytime` int(10) DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tploperator')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tploperator` varchar(200) DEFAULT '' COMMENT '模板id';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission_keywords')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission_keywords` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'link_card')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_card` varchar(500) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'link_sign')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_sign` varchar(500) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'link_sign_name')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_sign_name` varchar(100) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'link_card_name')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_card_name` varchar(100) DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'link_recharge')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_recharge` varchar(500) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'link_recharge_name')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `link_recharge_name` varchar(100) DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_tea_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_tea_money` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'tea_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `tea_money` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'tea_tip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `tea_tip` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_stores', 'is_floor_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_floor_money` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'floor_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `floor_money` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'floor_tip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `floor_tip` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_default_rate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_default_rate` tinyint(1) NOT NULL DEFAULT '1' COMMENT '默认1,自定义2';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'getcash_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `getcash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最低提现金额';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'fee_rate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `fee_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '提现费率';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'fee_min')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `fee_min` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'fee_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `fee_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最高金额';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_savewine')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_savewine` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持寄存';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'notice_space_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `notice_space_time` int(10) DEFAULT '300';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_operator1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_operator1` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持呼叫服务员';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_operator2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_operator2` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持打包';");
}
if (!pdo_fieldexists('weisrc_dish_commission', 'level')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_commission') . " ADD `level` tinyint(1) NOT NULL DEFAULT '1' COMMENT '级别';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'lasttime')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `lasttime` int(10) DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'agentid2')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `agentid2` int(11) DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'agentid3')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `agentid3` int(11) DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission_level')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission_level` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '分销级别';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'share_title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `share_title` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'share_desc')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `share_desc` varchar(300) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'share_image')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `share_image` varchar(500) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'commission2_rate_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission2_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission2_value_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission2_value_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission3_rate_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission3_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission3_value_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission3_value_max` int(10) unsigned NOT NULL DEFAULT '0'
COMMENT '提现手续费最低金额';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_commission')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_commission` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启分销';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission1_rate_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission1_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission1_value_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission1_value_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission_settlement')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission_settlement` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '佣金结算方式';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'getcash_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `getcash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最低提现金额';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'fee_rate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fee_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '提现费率';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'fee_min')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fee_min` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'fee_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `fee_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最高金额';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'is_operator_pwd')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_operator_pwd` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'operator_pwd')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `operator_pwd` varchar(50) DEFAULT '';");
}
//ALTER TABLE ims_weisrc_dish_setting ADD `operator_pwd` varchar(50) DEFAULT '';
//ALTER TABLE ims_weisrc_dish_setting ADD `is_operator_pwd` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';

if (!pdo_fieldexists('weisrc_dish_fans', 'noticetime')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `noticetime` int(10) DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_fans', 'agentid')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_fans') . " ADD `agentid` int(11) DEFAULT '0';");
}
if (!pdo_fieldexists('weisrc_dish_stores', 'kefu_qrcode')) {
    pdo_query("ALTER TABLE " . tablename('weisrc_dish_stores') . " ADD `kefu_qrcode` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'dining_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型1店内2外卖3预定4快餐';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'charges')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `charges` varchar(20) DEFAULT '' COMMENT '手续费';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'successprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `successprice` varchar(20) DEFAULT '' COMMENT '到帐金额';");
}
if(!pdo_fieldexists('weisrc_dish_category', 'is_meal')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐';");
}
if(!pdo_fieldexists('weisrc_dish_category', 'is_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐';");
}
if(!pdo_fieldexists('weisrc_dish_category', 'is_snack')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐';");
}
if(!pdo_fieldexists('weisrc_dish_category', 'is_reservation')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定';");
}

if(!pdo_fieldexists('weisrc_dish_goods', 'labelid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `labelid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '打印标签';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'startcount')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `startcount` int(10) unsigned NOT NULL DEFAULT '1';");
}


if(!pdo_fieldexists('weisrc_dish_goods', 'endcount')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `endcount` int(10) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'freecount')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `freecount` int(10) unsigned NOT NULL DEFAULT '0';");
}


if(!pdo_fieldexists('weisrc_dish_goods', 'isshow_sales')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `isshow_sales` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_goods', 'isoptions')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `isoptions` tinyint(1) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'content')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `content` text COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_goods', 'memberprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `memberprice` varchar(10) NOT NULL DEFAULT '' COMMENT '会员价';");
}

if(!pdo_fieldexists('weisrc_dish_goods', 'lasttime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `lasttime` int(10) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'deleted')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'counts')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `counts` int(10) NOT NULL DEFAULT '-1';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'sales')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `sales` int(10) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'today_counts')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `today_counts` int(10) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'packvalue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'packvalue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'ischeckfans')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `ischeckfans` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'newlimitprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `newlimitprice` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'oldlimitprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `oldlimitprice` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'newlimitpricevalue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `newlimitpricevalue` varchar(10) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'oldlimitpricevalue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `oldlimitpricevalue` varchar(10) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'discount_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `discount_money` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'quicknum')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `quicknum` varchar(30) NOT NULL DEFAULT '0001' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'isvip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `isvip` tinyint(1) NOT NULL DEFAULT '0' COMMENT '会员';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'service_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `service_money` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'tea_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `tea_money` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'floor_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `floor_money` decimal(10,2) DEFAULT '0.00';");
}
//

if(!pdo_fieldexists('weisrc_dish_order', 'isfeedback')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `isfeedback` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否留言';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'couponid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `couponid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'is_append')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `is_append` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否加单';");
}
if(pdo_fieldexists('weisrc_dish_order_goods', 'price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order_goods')."  MODIFY column price decimal(10,2) NOT NULL default '0.00' COMMENT
 '商品价格';");
}

if(pdo_fieldexists('weisrc_dish_businesslog', 'price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')."  MODIFY column price decimal(10,2) default '0.00' COMMENT
 '申请金额';");
}
if(pdo_fieldexists('weisrc_dish_businesslog', 'charges')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')."  MODIFY column charges decimal(10,2) default '0.00' COMMENT
 '手续费';");
}
if(pdo_fieldexists('weisrc_dish_businesslog', 'successprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')."  MODIFY column successprice decimal(10,2) default '0.00' COMMENT
 '到帐金额';");
}
if(pdo_fieldexists('weisrc_dish_businesslog', 'haveprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')."  MODIFY column haveprice decimal(10,2) default '0.00' COMMENT
 '已申请总金额';");
}
if(pdo_fieldexists('weisrc_dish_businesslog', 'totalprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')."  MODIFY column totalprice decimal(10,2) default '0.00' COMMENT
 '当时可总金额';");
}

if(!pdo_fieldexists('weisrc_dish_tablezones', 'service_rate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tablezones')." ADD `service_rate` decimal(10,2) DEFAULT '0.00';");
}

if(!pdo_fieldexists('weisrc_dish_fans', 'country')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `country` varchar(50) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_fans', 'storeids')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `storeids` text COMMENT '门店';");
}

if(!pdo_fieldexists('weisrc_dish_fans', 'province')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `province` varchar(50) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_fans', 'city')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `city` varchar(50) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_tables', 'url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tables')." ADD `url` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_tables', 'is_seat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tables')." ADD `is_seat` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
//

if(!pdo_fieldexists('weisrc_dish_tables', 'thumb')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tables')." ADD `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片';");
}
if(!pdo_fieldexists('weisrc_dish_tables', 'scene_str')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tables')." ADD `scene_str` varchar(500) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_tables', 'print_label')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_tables')." ADD `print_label` int(4) NOT NULL DEFAULT 0 COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_account', 'pay_account')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `pay_account` varchar(200) NOT NULL COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'from_user')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'schoolid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'brandname')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `brandname` varchar(20) DEFAULT '品牌' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'delivery_within_days')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `delivery_within_days` int(10) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'delivery_radius')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `delivery_radius` decimal(18,1) NOT NULL DEFAULT '0.0' COMMENT '半径';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'not_in_delivery_radius')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `not_in_delivery_radius` tinyint(1) NOT NULL DEFAULT '1' COMMENT '在配送半径之外是否允许下单';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'screen_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `screen_mode` tinyint(1) NOT NULL DEFAULT '1';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'screen_title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `screen_title` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'screen_bg')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `screen_bg` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'screen_bottom')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `screen_bottom` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_wechat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_alipay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_credit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_jueqi_ymf')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_jueqi_ymf` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'jueqi_host')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `jueqi_host` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'jueqi_customerId')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `jueqi_customerId` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'jueqi_secret')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `jueqi_secret` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_stores', 'btn_reservation')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_reservation` varchar(100) NOT NULL DEFAULT '预定' COMMENT '预定按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_eat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_eat` varchar(100) NOT NULL DEFAULT '点菜' COMMENT '点菜按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_delivery` varchar(100) NOT NULL DEFAULT '外卖' COMMENT '外卖按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_snack')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_snack` varchar(100) NOT NULL DEFAULT '快餐' COMMENT '快餐按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_queue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_queue` varchar(100) NOT NULL DEFAULT '排队' COMMENT '排队按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_intelligent')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_intelligent` varchar(100) NOT NULL DEFAULT '套餐' COMMENT '套餐按钮';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_snack')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_snack` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持快餐';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_reservation')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_reservation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持预定';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_contain_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_contain_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_quick_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_quick_money` tinyint(1) NOT NULL DEFAULT '0' COMMENT '提现周期';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_virtual')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_virtual` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'table_cover')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `table_cover` varchar(500) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'table_desc')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `table_desc` varchar(200) DEFAULT '' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_order', 'one_order_getprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `one_order_getprice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '每单提现手续费';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'seat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `seat` int(10) NOT NULL DEFAULT '0' COMMENT '';");
}

//

if(!pdo_fieldexists('weisrc_dish_order', 'delivery_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '配送模式';");
}

//

if(!pdo_fieldexists('weisrc_dish_order', 'isfengniao')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `isfengniao` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'is_hasten')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `is_hasten` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'hastentime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `hastentime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_hasten')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_hasten` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'refund_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `refund_price` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_service_log', 'orderid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_service_log')." ADD `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号'");
}
if(!pdo_fieldexists('weisrc_dish_service_log', 'type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_service_log')." ADD `type` tinyint(1) NOT NULL DEFAULT '4' COMMENT '订单:1,服务员:2,打包:3,消息:4';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'one_order_getprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `one_order_getprice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '每单提现手续费';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'service_range')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `service_range` int(10) unsigned NOT NULL DEFAULT '20000' COMMENT
'服务范围';");
}


if (!pdo_fieldexists('weisrc_dish_feedback','replycontent')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_feedback')." ADD `replycontent` varchar(500) DEFAULT '' COMMENT '回复内容';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_queue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_queue` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持排队';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery_mode1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery_mode1` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery_mode2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery_mode2` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_more_meal')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_more_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_stores', 'is_intelligent')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_intelligent` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持套餐';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'begintime1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `begintime1` varchar(20) DEFAULT '09:00' COMMENT '开始时间';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'endtime1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `endtime1` varchar(20) DEFAULT '18:00' COMMENT '结束时间';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'begintime2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `begintime2` varchar(20) DEFAULT '09:00' COMMENT '开始时间';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'endtime2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `endtime2` varchar(20) DEFAULT '18:00' COMMENT '结束时间';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery_distance')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery_distance` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持配送距离';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_title1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_title1` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_title2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_title2` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_title3')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_title3` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_link1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_link1` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_link2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_link2` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'coupon_link3')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `coupon_link3` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠名称';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'qq')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `qq` varchar(20) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'weixin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `weixin` varchar(20) NOT NULL DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'credit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `credit` varchar(10) NOT NULL DEFAULT '0' COMMENT '赠送积分';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'oldtotalprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `oldtotalprice` varchar(10) NOT NULL COMMENT '原总金额';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'paydetail')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `paydetail` varchar(1000) NOT NULL DEFAULT '' COMMENT '消费详细信息';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'areaid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `areaid` int(10) NOT NULL DEFAULT '0' COMMENT '区域id';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'print_sta')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `print_sta` tinyint(1) DEFAULT '-1' COMMENT '打印状态';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'tables')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `tables` varchar(10) NOT NULL DEFAULT '' COMMENT '桌号';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'dining_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '用餐类型 1:到店 2:外卖';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'address')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `address` varchar(250) NOT NULL DEFAULT '' COMMENT '地址';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'sign')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `sign` tinyint(1) NOT NULL DEFAULT '0' COMMENT '-1拒绝，0未处理，1已处理';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'reply')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `reply` varchar(1000) NOT NULL DEFAULT '' COMMENT '回复';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'finishtime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `finishtime` int(10) DEFAULT '0' COMMENT '完成时间';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'confirmtime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `confirmtime` int(10) DEFAULT '0' COMMENT '确认时间';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'paytime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `paytime` int(10) DEFAULT '0' COMMENT '付款时间';");
}


if(!pdo_fieldexists('weisrc_dish_setting', 'follow_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `follow_url` varchar(500) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'is_yunzhong')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_yunzhong` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'isneedfollow')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `isneedfollow` tinyint(1) DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `mode` tinyint(1) NOT NULL DEFAULT '0' COMMENT '模式';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tplnewqueue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplnewqueue` varchar(200) DEFAULT '' COMMENT '模板id';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_nums')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_nums` tinyint(1) NOT NULL DEFAULT '0' COMMENT '每个商品打印一次';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'storeid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '默认门店';");
}
if(!pdo_fieldexists('weisrc_dish_businesslog', 'reason')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `reason` varchar(1000) DEFAULT '0' COMMENT '';");
}


if(!pdo_fieldexists('weisrc_dish_setting', 'dining_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '用餐类型 1:到店 2:外卖';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tpltype')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tpltype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '模版行业类型';");
}

if(!pdo_fieldexists('weisrc_dish_print_setting', 'api_key')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `api_key` varchar(100) DEFAULT '' COMMENT 'api密钥';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'api_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `api_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '打印机api类型';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `title` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_print_all')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_print_all` tinyint(1) NOT NULL DEFAULT '1';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'print_goodstype')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `print_goodstype` varchar(500) DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'print_label')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `print_label` varchar(500) DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_meal')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_snack')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_reservation')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'searchword')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `searchword` varchar(1000) DEFAULT '' COMMENT '搜索关键字';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_hot')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_hot` tinyint(1) NOT NULL DEFAULT '0' COMMENT '搜索页显示';");
}

if(!pdo_fieldexists('weisrc_dish_businesslog', 'business_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_businesslog')." ADD `business_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_type` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_openid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_openid` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_username')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_username` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_alipay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_alipay` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'business_wechat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_wechat` varchar(200) NOT NULL DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_email_setting', 'email_host')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_email_setting')." ADD `email_host` varchar(50) DEFAULT '' COMMENT '邮箱服务器';");
}
if(!pdo_fieldexists('weisrc_dish_email_setting', 'email_send')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_email_setting')." ADD `email_send` varchar(20) DEFAULT '' COMMENT '商户发送邮件邮箱';");
}
if(!pdo_fieldexists('weisrc_dish_email_setting', 'email_pwd')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_email_setting')." ADD `email_pwd` varchar(20) DEFAULT '' COMMENT '邮箱密码';");
}
if(!pdo_fieldexists('weisrc_dish_email_setting', 'email_user')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_email_setting')." ADD `email_user` varchar(100) DEFAULT '' COMMENT '发信人名称';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_meal')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_meal` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否店内点餐';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否外卖订餐';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'sendingprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `sendingprice` varchar(10) NOT NULL DEFAULT '' COMMENT '起送价格';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'freeprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `freeprice` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_bank_pay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_bank_pay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持银行支付';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'bank_pay_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `bank_pay_id` int(10) NOT NULL DEFAULT '0' COMMENT '银行活动ID';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'begintime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'announce')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `announce` varchar(1000) NOT NULL DEFAULT '' COMMENT '通知';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'endtime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'consume')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `consume` varchar(20) NOT NULL COMMENT '人均消费';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'level')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `level` tinyint(1) NOT NULL DEFAULT '1' COMMENT '级别';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_rest')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_rest` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_reservation_today')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_reservation_today` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'reservation_tip')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `reservation_tip` varchar(200) NOT NULL DEFAULT '请输入备注，人数口味等等（可不填）' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_dispatcharea')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_dispatcharea` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用配送区域';");
}

if(!pdo_fieldexists('weisrc_dish_print_setting', 'qrcode_status')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `qrcode_status` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_print_setting', 'qrcode_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `qrcode_url` varchar(200) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_print_setting', 'qrcode_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `qrcode_url` varchar(200) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'dispatchprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `dispatchprice` decimal(10,2) DEFAULT '0.00';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'typeid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `typeid` int(10) NOT NULL DEFAULT '0' COMMENT '商家类型';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'transid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `transid` varchar(30) NOT NULL DEFAULT '0' COMMENT '微信支付单号';");
}
if(!pdo_fieldexists('weisrc_dish_cart', 'packvalue')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')." ADD `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费';");
}
if(!pdo_fieldexists('weisrc_dish_cart', 'tableid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')." ADD `tableid` int(11) NOT NULL DEFAULT '0' COMMENT '';");
}

//


if(!pdo_fieldexists('weisrc_dish_cart', 'optionid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')." ADD `optionid` varchar(200) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_cart', 'optionname')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')." ADD `optionname` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_order_goods', 'optionid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order_goods')." ADD `optionid` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_order_goods', 'optionname')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order_goods')." ADD `optionname` varchar(200) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_goods_option', 'start')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods_option')." ADD `start` varchar(50) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_goods_option', 'type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods_option')." ADD `type` int(10) DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'goodsprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `goodsprice` decimal(10,2) default '0.00';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'ispay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `ispay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0,1,2'");
}

if(!pdo_fieldexists('weisrc_dish_order', 'dispatchprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `dispatchprice` decimal(10,2) DEFAULT '0.00';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'isemail')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `isemail` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'issms')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `issms` tinyint(1) NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'tablezonesid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `tablezonesid` varchar(10) NOT NULL DEFAULT '' COMMENT '桌台类别';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'istpl')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `istpl` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'istplnotice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `istplnotice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否模版通知';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tplneworder')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tplneworder` varchar(200) DEFAULT '' COMMENT '模板id';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tpluser')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tpluser` text COMMENT '通知用户';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_notice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_notice` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '开启提醒';");
}

if(!pdo_fieldexists('weisrc_dish_print_setting', 'type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `type` varchar(50) DEFAULT 'hongxin';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'member_code')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `member_code` varchar(100) DEFAULT '' COMMENT '商户代码';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'feyin_key')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `feyin_key` varchar(100) DEFAULT '' COMMENT 'api密钥';");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'print_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `print_type` tinyint(1) NOT NULL;");
}
if(!pdo_fieldexists('weisrc_dish_print_setting', 'is_shouyin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_setting')." ADD `is_shouyin` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持收银';");
}

if(!pdo_fieldexists('weisrc_dish_coupon', 'is_meal')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐';");
}
if(!pdo_fieldexists('weisrc_dish_coupon', 'dcredit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `dcredit` int(10) NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_coupon', 'is_delivery')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐';");
}
if(!pdo_fieldexists('weisrc_dish_coupon', 'is_snack')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐';");
}
if(!pdo_fieldexists('weisrc_dish_coupon', 'is_reservation')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定';");
}
if(!pdo_fieldexists('weisrc_dish_coupon', 'is_shouyin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_coupon')." ADD `is_shouyin` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持收银';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'sms_enable')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `sms_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启短信提醒';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'sms_username')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `sms_username` varchar(20) DEFAULT '' COMMENT '平台帐号';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'sms_pwd')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `sms_pwd` varchar(20) DEFAULT '' COMMENT '平台密码';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'sms_mobile')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `sms_mobile` varchar(20) DEFAULT '' COMMENT '商户接收短信手机';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'email_enable')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启邮箱提醒';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'email_host')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email_host` varchar(50) DEFAULT '' COMMENT '邮箱服务器';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'email_send')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email_send` varchar(100) DEFAULT '' COMMENT '商户发送邮件邮箱';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'email_pwd')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email_pwd` varchar(20) DEFAULT '' COMMENT '邮箱密码';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'email_user')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email_user` varchar(100) DEFAULT '' COMMENT '发信人名称';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'email')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `email` varchar(100) DEFAULT '' COMMENT '商户接收邮件邮箱';");
}

if(!pdo_fieldexists('weisrc_dish_type', 'url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_type')." ADD `url` varchar(200) NOT NULL DEFAULT '' COMMENT '链接';");
}
if(!pdo_fieldexists('weisrc_dish_type', 'thumb')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_type')." ADD `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片';");
}

if(!pdo_fieldexists('weisrc_dish_category', 'rebate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD rebate decimal(5,2) NOT NULL default 10.00 COMMENT '打折费率';");
}
if(!pdo_fieldexists('weisrc_dish_category', 'is_discount')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD is_discount int(2) NOT NULL default 0 COMMENT '是否开启打折';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'week')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `week` varchar(100) NOT NULL DEFAULT '1,2,3,4,5,6,0' COMMENT '星期';");
}

if(!pdo_fieldexists('weisrc_dish_account', 'role')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `role` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1:店长,2:店员';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'username')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `username` varchar(50) NOT NULL COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_admin_order')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_admin_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_notice_order')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_notice_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'is_notice_service')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `is_notice_service` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'remark')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `remark` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注';");
}

if(pdo_fieldexists('weisrc_dish_order', 'totalprice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')."  MODIFY COLUMN totalprice decimal(10,2) not null default 0.00 comment '总价格';");
}

if(pdo_fieldexists('weisrc_dish_cart', 'optionid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_cart')."  MODIFY COLUMN `optionid` varchar(200) DEFAULT '';");
}
if(pdo_fieldexists('weisrc_dish_order_goods', 'optionid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order_goods')."  MODIFY COLUMN `optionid` varchar(200) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'append_dish')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD COLUMN append_dish tinyint(2) not null default 0 comment '加菜' after  is_append;");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_vtiny_bankpay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_vtiny_bankpay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持银行支付';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'vtiny_bankpay_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `vtiny_bankpay_id` int(10) NOT NULL DEFAULT '0' COMMENT '银行活动ID';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'vtiny_bankpay_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `vtiny_bankpay_url` varchar(500) NOT NULL DEFAULT '' COMMENT '链接';");
}
pdo_query("UPDATE ".tablename('weisrc_dish_order')." SET totalprice=0 WHERE totalprice = '' OR totalprice<0;");
//5.3.2
if(!pdo_fieldexists('weisrc_dish_setting', 'commission_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '分销模式';");
}
if(!pdo_fieldexists('weisrc_dish_fans', 'is_commission')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `is_commission` tinyint(1) DEFAULT '1';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT
'配送通知模式';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_commission_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_commission_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '配送佣金模式';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'delivery_commission_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `delivery_commission_money` decimal(10,2) DEFAULT '0.00';");
}
//
//
if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_money` decimal(11,2) NOT NULL default '0' COMMENT '佣金';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_rate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'follow_title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `follow_title` varchar(500) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'follow_desc')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `follow_desc` varchar(500) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'follow_logo')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `follow_logo` varchar(500) DEFAULT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'commission_money_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `commission_money_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '佣金模式';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_home')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_home` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}

//配送区域
if(!pdo_fieldexists('weisrc_dish_account', 'areaid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `areaid` int(10) NOT NULL DEFAULT '0' COMMENT '区域id';");
}
//配送员
if(!pdo_fieldexists('weisrc_dish_order', 'delivery_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_id` int(10) NOT NULL DEFAULT '0' COMMENT
    '配送员id';");
}
//配送状态
if(!pdo_fieldexists('weisrc_dish_order', 'delivery_status')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT
'';");
}
//佣金
if(!pdo_fieldexists('weisrc_dish_order', 'delivery_money')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_money` decimal(11,2) NOT NULL default '0' COMMENT '佣金';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'commission_money1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `commission_money1` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '一级佣金';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'commission_money2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `commission_money2` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '二级佣金';");
}

if(!pdo_fieldexists('weisrc_dish_account', 'lat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度';");
}
if(!pdo_fieldexists('weisrc_dish_account', 'lng')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_account')." ADD `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_order_max')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_order_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配送订单数量限制';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_auto_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_auto_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '自动推送配送员时间设置';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'delivery_finish_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_finish_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '自动完成已配送订单';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'delivery_finish_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_finish_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '已配送时间';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_auto_address')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_auto_address` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'site_logo')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `site_logo` varchar(500) DEFAULT '';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'delivery_notice')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `delivery_notice` tinyint(1) NOT NULL DEFAULT '0';");
}

if(!pdo_fieldexists('weisrc_dish_fans', 'commission_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `commission_price` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_fans', 'delivery_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_fans')." ADD `delivery_price` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order_log', 'fromtype')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order_log')." ADD `fromtype` tinyint(1) NOT NULL DEFAULT '0' COMMENT '来源';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'deliveryareaid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `deliveryareaid` int(10) NOT NULL DEFAULT '0' COMMENT '配送点id';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'isprint')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `isprint` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_order', 'lat')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'lng')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'rechargeid')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `rechargeid` int(10) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_order', 'ismerge')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `ismerge` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否合并的单子';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'is_verify_mobile')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_verify_mobile` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'dayu_appkey')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `dayu_appkey` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'dayu_secretkey')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `dayu_secretkey` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'dayu_verify_code')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `dayu_verify_code` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'dayu_sign')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `dayu_sign` varchar(200) DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tiptype')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tiptype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tipbtn')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tipbtn` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'tipqrcode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `tipqrcode` varchar(500) DEFAULT '';");
}
if (!pdo_fieldexists('weisrc_dish_setting', 'statistics')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `statistics` text NOT NULL DEFAULT '';");
}

if (!pdo_fieldexists('weisrc_dish_setting', 'delivery_cash_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `delivery_cash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现最低金额';");
}

if (!pdo_fieldexists('weisrc_dish_setting', 'style_base')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `style_base` varchar(20) NOT NULL DEFAULT '#3190e8' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_setting', 'style_list_btn1')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `style_list_btn1` varchar(20) NOT NULL DEFAULT '#6a3f34' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_setting', 'style_list_btn2')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `style_list_btn2` varchar(20) NOT NULL DEFAULT '#a57664' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_setting', 'style_list_btn3')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `style_list_btn3` varchar(20) NOT NULL DEFAULT '#9995a3' COMMENT '';");
}
if (!pdo_fieldexists('weisrc_dish_setting', 'style_list_base')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `style_list_base` varchar(20) NOT NULL DEFAULT '#FE4F4E' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_shouyin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_shouyin` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'business_mobile')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `business_mobile` varchar(30) NOT NULL DEFAULT '' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'btn_shouyin')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_shouyin` varchar(100) NOT NULL DEFAULT '收银' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'deleted')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'is_delivery_time')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_delivery_time` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否特殊时间价格';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_toutiao')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_toutiao` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_show_visit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_show_visit` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_setting', 'credit_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `credit_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:商品积分;2订单金额计算';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'payx_credit')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `payx_credit` int(10) NOT NULL DEFAULT '0' COMMENT '消费一元积分';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'is_open_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `is_open_price` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '开启提现';");
}
if(!pdo_fieldexists('weisrc_dish_setting', 'auth_mode')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_setting')." ADD `auth_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_jxkj_unipay')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_jxkj_unipay` int(1) default '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'jxkj_pay_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `jxkj_pay_id` int(10) default '0';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'jxkj_pay_name')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `jxkj_pay_name` varchar(50) NOT NULL DEFAULT '万融收银';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'listinfo')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `listinfo` varchar(1000) NOT NULL DEFAULT '用餐高峰期请提前下单！' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_goods', 'istime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `istime` tinyint(1) unsigned NOT NULL DEFAULT '0';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'begintime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `begintime` varchar(20) DEFAULT '00:00' COMMENT '开始时间';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'endtime')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `endtime` varchar(20) DEFAULT '23:59' COMMENT '结束时间';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'startdate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `startdate` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间';");
}
if(!pdo_fieldexists('weisrc_dish_goods', 'enddate')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_goods')." ADD `enddate` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_type')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}

if(!pdo_fieldexists('weisrc_dish_stores', 'is_card')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_card` tinyint(1) NOT NULL DEFAULT '0' COMMENT '';");
}
//


if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_url')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_url` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_id')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_price')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_price` varchar(50) NOT NULL DEFAULT '15元' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_title` varchar(50) NOT NULL DEFAULT '商家优惠券' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_stores', 'btn_coupon_desc')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `btn_coupon_desc` varchar(50) NOT NULL DEFAULT '消费满100元可用' COMMENT '';");
}
if(!pdo_fieldexists('weisrc_dish_intelligent', 'title')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_intelligent')." ADD `title` varchar(200) NOT NULL DEFAULT '' COMMENT '商品';");
}
if(!pdo_fieldexists('weisrc_dish_intelligent', 'thumb')) {
    pdo_query("ALTER TABLE ".tablename('weisrc_dish_intelligent')." ADD `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '';");
}



pdo_query("update ".tablename('users_permission')." set permission='weisrc_dish_menu_stores' where permission='weisrc_dish_menu_stores2';");

/**
 * 微点餐
 *
 * 作者:迷失卍国度
 *
 * qq : 15595755
ALTER TABLE ims_weisrc_dish_order ADD `ispay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0,1,2';
ALTER TABLE ims_weisrc_dish_print_setting ADD `qrcode_status` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_print_setting ADD `qrcode_url` varchar(200) DEFAULT '';
ALTER TABLE ims_weisrc_dish_print_setting ADD `print_status` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_order ADD `transid` varchar(30) NOT NULL DEFAULT '0' COMMENT '微信支付单号';
ALTER TABLE ims_weisrc_dish_order ADD `goodsprice` decimal(10,2) default '0.00';
ALTER TABLE ims_weisrc_dish_order ADD `dispatchprice` decimal(10,2) DEFAULT '0.00';
ALTER TABLE ims_weisrc_dish_order ADD `isemail` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_order ADD `issms` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_order ADD `istpl` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_stores ADD `dispatchprice` decimal(10,2) DEFAULT '0.00';
ALTER TABLE ims_qrcode ADD `url` varchar(500) NOT NULL DEFAULT '0' COMMENT '';
 *
更新

ALTER TABLE ims_weisrc_dish_order ADD `transid` varchar(30) NOT NULL DEFAULT '0' COMMENT '微信支付单号';
ALTER TABLE ims_weisrc_dish_order ADD `goodsprice` decimal(10,2) default '0.00';
ALTER TABLE ims_weisrc_dish_order ADD `dispatchprice` decimal(10,2) DEFAULT '0.00';
ALTER TABLE ims_weisrc_dish_order ADD `isemail` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_order ADD `issms` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_order ADD `istpl` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE ims_weisrc_dish_setting ADD `istplnotice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否模版通知';
ALTER TABLE ims_weisrc_dish_setting ADD `tplneworder` varchar(200) DEFAULT '' COMMENT '模板id';
ALTER TABLE ims_weisrc_dish_setting ADD `tpluser` text COMMENT '通知用户';
ALTER TABLE ims_weisrc_dish_stores ADD `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间';
ALTER TABLE ims_weisrc_dish_stores ADD `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间';
ALTER TABLE ims_weisrc_dish_stores ADD `consume` varchar(20) NOT NULL COMMENT '人均消费';
ALTER TABLE ims_weisrc_dish_stores ADD `level` tinyint(1) NOT NULL DEFAULT '1' COMMENT '级别';
ALTER TABLE ims_weisrc_dish_stores ADD `announce` varchar(1000) NOT NULL DEFAULT '' COMMENT '通知';
ALTER TABLE ims_weisrc_dish_stores ADD `typeid` int(10) NOT NULL DEFAULT '0' COMMENT '商家类型';
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_type` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
`name` varchar(50) NOT NULL COMMENT '类型名称',
`parentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID,0为第一级',
`displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_address` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`weid` int(10) unsigned NOT NULL,
`from_user` varchar(50) NOT NULL,
`realname` varchar(20) NOT NULL,
`mobile` varchar(11) NOT NULL,
`address` varchar(300) NOT NULL,
`dateline` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 */
//delete from ims_modules_bindings where module='weisrc_dish' and entry='menu';
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '门店管理', 'stores');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '区域管理', 'area');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '屏蔽用户', 'blacklist');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '系统设置', 'setting');
//delete from ims_modules_bindings where module='weisrc_dish' and entry='home';
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'home', '首页入口', 'wapindex');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'home', '门店列表入口', 'waprestList');
//delete from ims_modules_bindings where module='weisrc_dish' and entry='menu';
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '门店管理', 'stores');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '订单管理', 'allorder');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '门店类型', 'type');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '区域管理', 'area');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '广告管理', 'ad');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '会员管理', 'allfans');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '账号管理', 'account');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '模板管理', 'template');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'menu', '系统设置', 'setting');
//
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'cover', '我的订单入口', 'order');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'cover', '用户中心入口', 'usercenter');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'cover', '我邀请的好友入口', 'mymemberlist');
//
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'home', '我的订单入口', 'order');
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_dish', 'home', '用户中心入口', 'usercenter');
//`default_jump` tinyint(2) NOT NULL DEFAULT '1' COMMENT '默认类型'
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`,`direct`) values ('weisrc_dish', 'menu', '商家登录', 'login',1);
//insert ims_modules_bindings(`module`,`entry`,`title`,`do`) values ('weisrc_icard', 'menu', '系统设置', 'setting');
//DROP TABLE IF EXISTS `ims_weisrc_dish_area`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_blacklist`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_cart`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_category`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_email_setting`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_goods`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_intelligent`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_nave`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_order`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_order_goods`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_print_order`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_print_setting`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_reply`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_setting`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_sms_checkcode`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_sms_setting`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_mealtime`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_stores`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_address`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_collection`;
//DROP TABLE IF EXISTS `ims_weisrc_dish_type`;
//DROP TABLE IF EXISTS  `ims_weisrc_dish_account`;

//`fengniao_order_status` int(11) DEFAULT '0' COMMENT '状态码',
//  `fengniao_carrier_driver_name` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员姓名',
//  `fengniao_carrier_driver_phone` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员电话',
//  `address` varchar(200) DEFAULT '' COMMENT '定点次日达服务独有的字段: 微仓地址',
//  `fengniao_latitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓纬度',
//  `fengniao_longitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓经度',


//$sql = "
//CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_record` (
//    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
//    `weid` int(10) unsigned NOT NULL,
//    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
//    `savewineid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
//    `goodsid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
//    `total` int(10) unsigned NOT NULL DEFAULT '0',
//    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
//    PRIMARY KEY (`id`)
//) ENGINE=MyISAM DEFAULT CHARSET=utf8;
//        CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_goods` (
//  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
//  `weid` int(10) unsigned NOT NULL,
//  `storeid` int(10) unsigned NOT NULL,
//  `savewineid` int(10) unsigned NOT NULL,
//  `goodsid` int(10) unsigned NOT NULL,
//  `total` int(10) unsigned NOT NULL DEFAULT '1',
//  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
//  `dateline` int(10) unsigned NOT NULL,
//  `savetime` int(10) unsigned NOT NULL DEFAULT '0',
//  `takeouttime` int(10) unsigned NOT NULL DEFAULT '0',
//  PRIMARY KEY (`id`)
//) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
//        ";
//pdo_run($sql);
//if (!pdo_fieldexists('weisrc_dish_savewine_log','tablesid')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_savewine_log')." ADD `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
//}
//if (!pdo_fieldexists('weisrc_dish_category','savewinetime')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_category')." ADD `savewinetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '';");
//}

//if(!pdo_fieldexists('weisrc_dish_print_goods', 'price')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '';");
//}
//if(!pdo_fieldexists('weisrc_dish_print_goods', 'storeid')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `storeid` int(10) unsigned NOT NULL DEFAULT '0';");
//}
//if(!pdo_fieldexists('weisrc_dish_print_goods', 'optionid')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `optionid` varchar(200) DEFAULT '';");
//}
//if(!pdo_fieldexists('weisrc_dish_print_goods', 'optionname')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_print_goods')." ADD `optionname` varchar(200) DEFAULT '';");
//}
//if (!pdo_fieldexists('weisrc_dish_stores','is_sys_delivery')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_stores')." ADD `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送';");
//}
//if (!pdo_fieldexists('weisrc_dish_order','is_sys_delivery')) {
//    pdo_query("ALTER TABLE ".tablename('weisrc_dish_order')." ADD `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送';");
//}